home *** CD-ROM | disk | FTP | other *** search
/ NetNews Offline 2 / NetNews Offline Volume 2.iso / news / comp / std / c++ / 1154 < prev    next >
Encoding:
Internet Message Format  |  1996-08-06  |  2.7 KB

  1. Path: fido.asd.sgi.com!austern
  2. From: "Nathan Myers <http://www.cantrip.org/>" <ncm@cantrip.org>
  3. Newsgroups: comp.programming.threads,comp.std.c++
  4. Subject: Re: Is C++ STL MT-Safe?
  5. Date: 18 Apr 1996 09:42:10 PDT
  6. Organization: Best Internet Communications
  7. Approved: austern@isolde.mti.sgi.com
  8. Message-ID: <3175B960.3BCAE17D@cantrip.org>
  9. References: <4kmjvj$89t@usc.edu> <4kspmb$9tb@ubszh.fh.zh.ubs.com> <3173E95E.5AC@ix.netcom.com> <4l12rf$q11@galaxy.ucr.edu> <31753C02.58A6@ix.netcom.com>
  10. NNTP-Posting-Host: isolde.mti.sgi.com
  11. X-Original-Date: Wed, 17 Apr 1996 20:39:12 -0700
  12. X-Mailer: Mozilla 2.01 (X11; I; Linux 1.2.13 i386)
  13. X-Auth: PGPMoose V1.1 PGP comp.std.c++
  14.     iQBVAwUBMXZw40y4NqrwXLNJAQHekgH+MvzzkErpeB6f2/qmRh+xpDO+sY+OC9mz
  15.     aYDBVMAa37dO0Y8PYn/9GS9/jUiBxbGMd3q2ZqCaqZwWM35ys/5RRg==
  16.     =xzJZ
  17. Originator: austern@isolde.mti.sgi.com
  18.  
  19. David Brownell wrote:
  20. > Tom Payne wrote:
  21. > >
  22. > > David Brownell (brownell@ix.netcom.com) wrote:
  23. > > :
  24. > > : Someone else mentioned Rogue Wave.  Does anyone have URLS or something
  25. > > : through which the different "MT-enhanced" APIs could be compared?  I've
  26. > > : been organizing a collection of MT/C++ issues; one of the gaps is where
  27. > > : the standard C++ library interfaces need to be "MT-safed" according to
  28. > > : some useful and consistent policy.
  29. > >
  30. > > Is there agreement on what is meant by the term "thread safe."  (I have
  31. > > seen definitions that seemed quite inadequate.)
  32. > IMHO "Thread-safe" is a misleading goal.  You actually want an API that's
  33. > natural to use in a threaded environment ... in some cases, that means an
  34. > API that's OK to use from concurrent threads (e.g. add to containers),
  35. > but in other cases it's reasonable to have objects that are only usable
  36. > from a single thread (e.g. iterators).
  37.  
  38. In this sense, STL (and the whole std library) is already MT-safe.
  39. Of course this depends on it being implemented properly, but there are
  40. no interfaces in the standard C++ library that cry out for "_r" versions,
  41. as were found in the C library.  This is not accidental.
  42.  
  43. This is not to say that the STL containers can be shared between threads
  44. without some kind of synchronization.  Rather, it means that on a good
  45. implementation, two copies of a string which happen to share representation
  46. can be used by two threads, safely.  In other words, what is shared invisibly
  47. is handled; what you can see is your responsibility.
  48.  
  49. Nathan Myers
  50. ncm@cantrip.org  http://www.cantrip.org/
  51. ---
  52. [ comp.std.c++ is moderated.  To submit articles: Try just posting with your 
  53.                 newsreader.  If that fails, use mailto:std-c++@ncar.ucar.edu
  54.   comp.std.c++ FAQ: http://reality.sgi.com/austern/std-c++/faq.html
  55.   Moderation policy: http://reality.sgi.com/austern/std-c++/policy.html
  56.   Comments? mailto:std-c++-request@ncar.ucar.edu 
  57. ]
  58.